package initializer

import (
	"go_ruoyi/global"

	"github.com/redis/go-redis/v9"
)

func InitRedis() {
	host := global.Viper.GetString("redis.host")
	port := global.Viper.GetString("redis.port")
	password := global.Viper.GetString("redis.password")
	rdb := redis.NewClient(&redis.Options{
		Addr:     host + ":" + port,
		Password: password, // 没有密码，默认值
		DB:       0,        // 默认DB 0
	})
	global.Redis = rdb
}
